#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using pii = pair<int, int>;
using pll = pair<llt, llt>;

template<typename T>
istream & operator >> (istream & is, vector<T> & vec) {
    for(auto & i : vec) is >> i;
    return is;
}

template<typename T>
void input(vector<T> & vec, int n){
    vec.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> vec[i];
    return;
}


int N, M;
vector<string> S;

bool isOK(int st){
    int left = M;
    vector<int> flag(M, 0);
    for(int i=0;i<N;++i){
        if((1 << i) & st){
            for(int j=0;j<M;++j){
                if('o' == S[i][j]){
                    if(0 == flag[j]){
                        flag[j] = 1;
                        left -= 1;
                    }
                    
                }
            }
        }
    }
    return 0 == left;
}

int f(int pos){
    int ans = 0;
    for(int i=0;i<N;++i){
        if((1 << i) & pos) ans += 1;
    }
    return ans;
}

void work(){
    cin >> N >> M;
    S.assign(N, {});
    cin >> S;
    int ans = N;
    for(int i=1;i<(1<<N);++i){
        if(isOK(i)){
            ans = min(ans, f(i));
        }
    }
    cout << ans << "\n";
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}
